#ifndef IFONT_H
#define IFONT_H

#include "../assetfilemgr.h"
#include "../formats/fontformat.h"

//----------------------------------------------------------------
//----------------------------------------------------------------
class SFontVertex
{
public:
	f32			xy[2];
	u16			uv[2];
	u32			color;
};

//------------------------------------------------------
//	font interface
//------------------------------------------------------
class ITextFont : public SFontData
{
public:
	static void	*AssetInit( IAssetFile *pFile, const CMasterIndexEntry *pEntry, void *context );
	static void	AssetUninit( void *ptr, void *context );
	static void	AssetFixup( CAssetFileMgr *pMgr, const IAssetFile *pFile, void *ptr, const CMasterIndexEntry *pEntry );

	static void	Register( CAssetFileMgr *pMgr )
	{
		pMgr->AddAssetType("FONT",AssetInit,AssetUninit,AssetFixup);
	}

public:
	const SFontChar	*FindChar( unicode character ) const;
	void			GetTextSize( const unicode *pt, float outSize[2], f32 fontSize, f32 aspect ) const;

	u32				Print( const unicode *ptr, SFontVertex *out, f32 fontSize, f32 aspect=1.0f, u32 color=0xffffffff, f32 *outSize=0 ) const;
};

#endif
